<?php
class TVTKCommon{
    static function getYear() {
        $year = new Zend_Session_Namespace('year');
        if (!isset($year->year)) {
            $d = getdate();
            $db = Zend_Db_Table::getDefaultAdapter();
            $qr = $db->query("select YEAR from qtht_year order by YEAR DESC");
            $re = $qr->fetch();
            if ($re["YEAR"] && $d['year'] > $re["YEAR"]) {
                $year->year = $re["YEAR"];
            } else {
                $year->year = $d['year'];
            }
        }
        return $year->year;
    }
	static function MySQLDateToVNDate($date){
		$strarr = explode("-",$date);
		return $strarr[1]."/".$strarr[2]."/".$strarr[0];
	}
	static function VNDateToMySQLDate($date){
		$strarr = explode("/",$date);
		return $strarr[2]."-".$strarr[1]."-".$strarr[0];
	}
}
